1. Field of the Invention
Embodiments of the invention relate generally to graphics processing, and more specifically to selecting and transmitting components for output by a pixel shader.
2. Description of the Related Art
Prior art pixel shaders in three-dimensional (3D) graphics application programming interfaces (APIs) store and output component vectors of multiple components to a raster operations unit for blending operations and storage in a frame buffer. Vectors may be enabled or disabled for output to each render target (frame buffer) and one or more of the components in each vector may be individually disabled. Conventional pixel shaders store and output all of the multiple components for each enabled vector, potentially wasting storage resources and bandwidth when one or more of the components are disabled for a vector. Additionally, disabled components that are output should not be written to a render target since the data for the component is undetermined.
To avoid this overhead, implementations of 3D graphics APIs may recompile pixel shaders based on the vector and component enabled described above. However, such an approach involves a substantial amount of central processing unit (CPU) overhead. Substantial computation is required to track the various combinations of pixel shader and graphics API state, and to perform such recompilations whenever necessary.
Accordingly, what is needed in the art is a technique for storing only the enabled components for each enabled vector without shader recompilation and ensuring that the render target is written with enabled components, so that non-enabled component data stored in the render target remains unchanged.